<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script>
    var arr = [1, 2, 3, 5, 1, 6, 2, 7, 3, 3, 5, 8, 9]
    var arr1 = [];
    var verdict;
    for (var i = 0; i < arr.length; i++) {
        var j = i;
        do {
            switch (arr[i] === arr[j + 1]) {
                case true:
                    verdict = true;
                    break;
                case false:
                    j++;
                    verdict = false;
                    break;
            }
        } while (j < arr.length && verdict !== true)
        if (j === arr.length) {
            arr1[arr1.length] = arr[i]
        }
    }
    arr = arr1;
    console.log(arr);
</script>

<body>

</body>

</html>